{% extends 'base.html' %}

{% block title %}橘子问答-注册{% endblock title %}

{% block head %}
    <script src="{{url_for('static', filename='js/register.js')}}"></script>
{% endblock head %}

{% block content %}
    <div class="row mt-4">
        <div class="col-md-4">
        </div>
        <div class="col-md-4">
            <form method="post" action="{{ url_for('user.register') }}">
                <div class="form-group">
                    <label for="exampleInputEmail1">邮箱</label>
                    <input type="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" name="email" value="{{request.form.email}}">
                    <small id="emailHelp" class="form-text text-muted">{{form.email.errors[0]}}</small>
                </div>

                <div class="form-group">
                    <label for="exampleInputCode1">验证码</label>
                    <div class="input-group">
                        <input type="text" class="form-control" id="exampleInputCode1" name="captcha">
                        <div class="input-group-append">
                            <button class="btn btn-outline-secondary" type="button" id="btn_send_captcha">获取验证码</button>
                        </div>
                    </div>
                
                </div>

                <div class="form-group">
                    <label for="username">用户名</label>
                    <input type="text" class="form-control" id="username" name="username" value="{{request.form.username}}">
                    <small id="usernameHelp" class="form-text text-muted">{{form.username.errors[0]}}</small>
                </div>

                <div class="form-group">
                    <label for="exampleInputPassword1">密码</label>
                    <input type="password" class="form-control" id="exampleInputPassword1" name="password">
                </div>
                <div class="form-group">
                    <label for="exampleVerifyPassword1">确认密码</label>
                    <input type="password" class="form-control" id="exampleVerifyPassword1" name="password_confirm">
                </div>
                <button type="submit" class="btn btn-primary btn-block">注册</button>
            </form>
            <br>
            <div class="alert alert-info alert-dismissible fade show" role="alert">
                <strong>Tips:</strong> 
                {% for  msg in  get_flashed_messages() %} {{msg}} {% endfor %}
                <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                  <span aria-hidden="true">&times;</span>
                </button>
            </div>    
        </div>
        <div class="col-md-4">
        </div>
    </div>
{% endblock content %}